﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace landlord2lib
{
    public class CardStack
    {
        private List<List<Card>> m_stack;
        private List<Card> m_joker;

        public CardStack(Card[] cards)
        {
            FillStack(cards);
        }

        private void FillStack(Card[] cards)
        {
            m_stack = new List<List<Card>>();
            for (int i = (int)CardPoint.Card3; i <= (int)CardPoint.CardJoker; i++) m_stack.Add(new List<Card>());
            m_joker = new List<Card>();

            foreach (Card card in cards)
            {
                int i = (int)card.Point;
                m_stack[i].Add(card);
                if (card.IsJoker) m_joker.Add(card);
            }
        }

        public List<Card> this[int index]
        {
            get
            {
                return m_stack[index];
            }
        }

        public List<Card> this[CardPoint pt]
        {
            get
            {
                return m_stack[(int)pt];
            }
        }

        public List<Card> Joker
        {
            get
            {
                return m_joker;
            }
        }
    }
}
